/**
 * 
 */
package com.flashdeck.domain;

import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
import java.util.Set;




/**
 * @author Vincentas
 *
 */
public class Deck {
	
	private DeckInfo deckInfo;
	
	private Map<String, Card> cards;
	
	/* (non-Javadoc)
	 * @see java.lang.Object#toString()
	 */
	@Override
	public String toString() {
		return getDeckInfo().getName();
	}
	
	/**
	 * @return the cards
	 */
	public Set<Card> getCards() {
		return new HashSet<Card>(cards.values());
	}

	/**
	 * @param cards the cards to set
	 */
	public void setCards(Set<Card> cards) {
		this.cards = new HashMap<String,Card>();
		for (Card card : cards) {
			this.cards.put(card.getId(), card);
		}
	}

	/**
	 * @return the deckInfo
	 */
	public DeckInfo getDeckInfo() {
		return deckInfo;
	}

	/**
	 * @param deckInfo the deckInfo to set
	 */
	public void setDeckInfo(DeckInfo deckInfo) {
		this.deckInfo = deckInfo;
	}

	/**
	 * Number of groups for cards to be propagated through
	 * @return
	 */
	public int getGroups() {
		return 5;
	}
	
	public Card getCard(String cardId) {
		return cards.get(cardId);
	}
	
	
}
